#include<bits/stdc++.h>
#define For(i,a,b) for(int i=a,i##end=b;i<=i##end;i++)
#define Rof(i,a,b) for(int i=a,i##end=b;i>=i##end;i--)
#define rep(i  ,b) for(int i=1,i##end=b;i<=i##end;i++)
using namespace std;
const int N=2e6+9;
int read(){
	int f=0,x=0;
	char ch=getchar();
	while(!isdigit(ch)){f|=(ch=='-');ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	return f?-x:x;
}
int n,a[N],b[N];
int L,R,l,r;
int fa[N];
int get(int x){return fa[x]==x?x:fa[x]=get(fa[x]);}
void merge(int x,int y){x=get(x);y=get(y);fa[x]=y;}
void rebuild(){
	if(0-l>r-0){ 
		int mid=R-r;
		rep(i,r)merge(mid+i,mid-i);
		R-=r;r=0;
	} else{
		int mid=L-l;
		rep(i,-l)merge(mid-i,mid+i);
		L-=l;l=0;
	}
}
int ans[N];
void solve(){
	l=0,r=1000000;L=0;R=1000000;
	For(i,l,r)fa[i]=i;
	Rof(i,n-1,3){
		if(l<=0&&r<=0){
			r+=a[i];l+=a[i];
			if(l<0&&0<r)rebuild();
		}else if(l>=0&&r>=0){
			l-=a[i];r-=a[i];
			if(l<0&&0<r)rebuild();
		}else {assert(0);}
	}
	assert(r-l+1==R-L+1);
	For(i,L,R)ans[i]=abs(i-L+l);
}
signed main(){
//	system("fc pockets.out pockets4.out");return 0;
	freopen("pockets.in","r",stdin);
	freopen("pockets.out","w",stdout);
	n=read();rep(i,n-1)a[i]=read();
	int sum=0;For(i,3,n-1)sum+=a[i];
	solve();
	int q=read();
	while(q--){
		a[n]=read();int z=0;
		if(a[n]>1000000)z=a[n]-sum;
		else z=ans[get(a[n])];
		printf("%d\n",a[1]-a[2]+z);
	}
	return 0;
}

